import NewsModel from "../../../models/News";
import config from "../../../config/config";
import Crypt from "../../../utils/Crypt";

const newsModel = new NewsModel()

Page({
  data: {
    detail: {},
  },
  onLoad: function (options) {
    newsModel.getView({ id: options.id }).then(response => {
      let { data } = response
      data = Crypt.parse(data)

      // data.inText = data.inText.replace(/<[^>]+>/g, '')

      const list = []
      data.inImages.forEach(x => {
        const item = config.app_base_url + x
        list.push(item)
      })
      data.inImages = list

      this.setData({ detail: data })
      console.log(data)
    })
  }
});
